package com.esri.android.action;

import android.content.Context;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.esri.core.tasks.identify.IdentifyResult;

/* loaded from: classes.dex */
public class IdentifyResultView extends TableLayout {
    private IdentifyResult a;

    public IdentifyResultView(Context context) {
        super(context);
    }

    public IdentifyResultView(Context context, IdentifyResult identifyResult) {
        super(context);
        this.a = identifyResult;
        if (identifyResult != null) {
            a();
        }
    }

    public void setResult(IdentifyResult identifyResult) {
        removeAllViews();
        this.a = identifyResult;
        if (identifyResult != null) {
            a();
        }
    }

    private void a() {
        a("Layer ID", String.valueOf(this.a.getLayerId()));
        a("Layer Name", this.a.getLayerName());
        a("Value", this.a.getValue() == null ? "" : this.a.getValue().toString());
        a("Display field name", this.a.getDisplayFieldName());
        if (this.a.getGeometry() != null) {
            a("Geometry", this.a.getGeometry().getType().name());
        } else {
            a("Geometry", "None");
        }
        if (this.a.getAttributes() != null) {
            for (String str : this.a.getAttributes().keySet()) {
                a(str, this.a.getAttributes().get(str) == null ? "" : this.a.getAttributes().get(str).toString());
            }
        }
    }

    private void a(String str, String str2) {
        TableRow tableRow = new TableRow(getContext());
        TextView textView = new TextView(getContext());
        textView.setGravity(3);
        textView.setText(str);
        textView.setTextColor(-1);
        tableRow.addView(textView);
        TextView textView2 = new TextView(getContext());
        textView2.setGravity(17);
        textView2.setText(" : ");
        textView2.setTextColor(-1);
        tableRow.addView(textView2);
        TextView textView3 = new TextView(getContext());
        textView3.setGravity(3);
        textView3.setText(str2);
        textView3.setTextColor(-1);
        tableRow.addView(textView3);
        addView(tableRow);
    }
}
